import { defineStore } from "pinia";
import { updateOne, createSchemes, getDataOne } from "@/api/design/schemes.js";
const wellIfoStore = defineStore("wellIfo", () => {
  const params = reactive({
    wellId: "",
    wellCategory: "",
    wellType: "",
    customerName: "",
    drillingUnit: "",
    maximumDepth: "",
    wellLocation: "",
    bottomTemperature: "",
    bottomPressure: "",
    safetyTime: "",
    tectonicSetting: "",
    maximumInclination: "",
    groundElevation: 0,
    compensationDistance: 0,
    hazardousGas: "",
    mudParameters: {
      density: "",
      ph: "",
      properties: "",
      viscosity: "",
      waterLossRate: "",
    },
    teamNumber: "",
    teamQualification: "",
    vehicleNumber: "",
    hseList: [
      {
        equipmentName: "有毒有害检测仪",
        specification: "",
        numbers: "",
        condition: "",
      },
      {
        equipmentName: "伽马射线探测仪",
        specification: "",
        numbers: "",
        condition: "",
      },
      {
        equipmentName: "正压式空气呼吸器",
        specification: "",
        numbers: "",
        condition: "",
      },
      {
        equipmentName: "灭火器",
        specification: "",
        numbers: "",
        condition: "",
      },
      {
        equipmentName: "电缆悬挂器",
        specification: "",
        numbers: "",
        condition: "",
      },
    ],
    cableInformation: {
      length: "",
      revisionDeepDate: "",
      revisionDeepTimes: "",
      specification: "",
      splicingPosition: "",
      startDate: "",
      tensileDate: "",
      tensileValue: "",
    },
    complexTools: [
      {
        condition: "",
        numbers: "",
        specification: "",
        toolName: "",
      },
    ],
  });
  function setParams() {
    let schemeId = localStorage.getItem("schemeId");
    getDataOne(schemeId).then((res) => {
      params = res;
      for (const key in res) {
        params[key] = res[key];
      }
    });
  }
});
export default wellIfoStore;
